use serde::{Deserialize, Serialize};

use super::file_info::FileInfo;


#[derive(Serialize, Deserialize, Clone)]
pub struct GroupInfo {
    pub id:String,
    pub name:String,
    pub pid:String,
    pub pids:String,
    pub create_time:i64,
    pub creator_lid:String,
    pub creator_name:String,
    pub updater_lid:String,
    pub updater_name:String,
    pub up_ver:i16,
    pub sort:i16,
    pub tenant_id:i64,
    pub deleted:bool,
    pub update_time:i64,

    pub file_list:Vec<FileInfo>
}


impl Default for GroupInfo {
    fn default() -> Self {
        GroupInfo {
            id:String::from(""),
            name: String::from(""),
            pid:String::from(""),
            pids: String::from("[0]"),
            create_time: 0,
            creator_lid: String::from(""),
            creator_name: String::from(""),
            updater_lid: String::from(""),
            updater_name: String::from(""),
            up_ver: 0,
            sort: 0,
            tenant_id: 0,
            deleted: false,
            update_time: 0,
            file_list: vec![]
        }
    }
}

impl GroupInfo {
    pub fn set_file_list(&mut self, files: Vec<FileInfo>) 
    {
        self.file_list = files;
    }
}

